package com.tj.collection.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: pavan
 * Date: 2020/3/26
 * Time: 上午10:46
 */
public enum DeductTypeEnum {

    TYPE_NO("0", "No", ""),
    TYPE1("1", "-30% penalty", "30% penalty"),
    TYPE2("2", "-50% penalty", "50% penalty"),
    TYPE3("3", "-100% penalty", "100% penalty"),
    TYPE4("4", "-100% penalty && interest", "100% penalty and interest"),
    TYPE5("5", "-100% interest", "100% interest"),
    ;

    private String value;
    private String name;

    private String desc;//短信内容用

    DeductTypeEnum(String value, String name, String desc) {
        this.value = value;
        this.name = name;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public DeductTypeEnum setValue(String value) {
        this.value = value;
        return this;
    }

    public String getName() {
        return name;
    }

    public DeductTypeEnum setName(String name) {
        this.name = name;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public DeductTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static DeductTypeEnum getEnum(String value) {
        for (DeductTypeEnum enums : DeductTypeEnum.values()) {
            if (enums.getValue().equals(value)) {
                return enums;
            }
        }
        return null;
    }

    private static List<DeductTypeEnum> appDeductTypeEnumList = null;
    private static List<DeductTypeEnum> webDeductTypeEnumList = null;

    public static List<DeductTypeEnum> getAppDeductTypeEnumList() {
        if (appDeductTypeEnumList == null) {
            List<DeductTypeEnum> tmp = new ArrayList<>();
            tmp.add(TYPE_NO);
            appDeductTypeEnumList = tmp;
        }
        return appDeductTypeEnumList;
    }

    public static List<DeductTypeEnum> getWebDeductTypeEnumList() {
        if (webDeductTypeEnumList == null) {
            List<DeductTypeEnum> tmp = new ArrayList<>();
            tmp.add(TYPE1);
            tmp.add(TYPE2);
            tmp.add(TYPE3);
            webDeductTypeEnumList = tmp;
        }
        return webDeductTypeEnumList;
    }
}
